Welcome to Computer Programming

 

Array Activities in HWJ12_Arrays

 

Create the following methods

 

Start with the code below:

							/**
							 * HWJ15_Arrays - basic practice of Arrays
							 *
							 * @author (your name)
							 * @version 1.17
							 */
							public class HWJ12_Arrays
							{
							    //I put the word static so that we can run this easily in bluej
							    static int[] nums={10,25,17,49,95,67,55,56,12,24};
							    static String[] names={"Paul","Domingos","Hibak","Galen"};

							    //Print out all the numbers in the array.  Then all the names
							    public static void classroomPlay()
							    {

							    }

							    //Print out all the numbers in the array.
							    public static void printNums()
							    {

							    }

							    //Find the sum of all the numbers in the array and print that out.
							    public static void printSum()
							    {

							    }

							    //Find the biggest of all the numbers in the array and print that out.
							    public static void findBiggest()
							    {

							    }

							    //Add 7 to every number in the array. //YOU HAVE TO USE A FOR LOOP ( NOT FOR EACH)
							    public static void add7ToAll()
							    {

							    }

							    //Replace all values with random ints numbers between 1 and 100 and print it out //YOU HAVE TO USE A FOR LOOP ( NOT FOR EACH)
							    public static void replaceWithRandom()
							    {

							    }

							    //Have it print out every name with an insult, like Galen looks like a ostrich, Hibak looks like an ostrich, each on its own line.
							    public static void printInsult()
							    {

							    }

							    //Have it print out the length of each name
							    public static void printNameLengths()
							    {

							    }


							    //BELOW FOR ADVANCED
							    //[advanced]Have it print only the evens
							    public static void printEvens()
							    {

							    }

							    //[advanced]Add an exclamation point to everyones name
							    public static void addExclamation()
							    {
							    }

							    //[advanced]Have it print the 2nd biggest
							    public static void findSecondBiggest()
							    {
							    }
							    //[advanced]Have it flip the order of the numbers (so the first number is now the last
							    public static void flipOrder()
							    {

							    }

							    //[advanced]Have it say which word comes first alphabetically (use compareTo)
							    public static String findFirstName()
							    {
							        return null;
							    }

							    //advanced Sort the array
							    public static void sortNums()
							    {
							    }
							    //advanced - sort the names
							    public static void sortNames()
							    {
							    }

							    public static int findRandom (int start, int end)
							    {
							        int multiplier = end-start+1;
							        int random = (int) (Math.random()*multiplier)+start;
							        return random;
							    }
							}